Int[] Reverse - What does this actually do?
Posted
by Jamie Dixon
on Stack Overflow
See other posts from Stack Overflow
or by Jamie Dixon
Published on 2010-04-19T21:19:08Z
Indexed on
2010/04/19
21:23 UTC
Read the original article
Hit count: 312
I was just having a play around with some code in LINQPad and noticed that on an int array there is a Reverse method.
Usually when I want to reverse an int array I'd do so with
Array.Reverse(myIntArray);
Which, given the array {1,2,3,4} would then return 4 as the value of myIntArray[0].
When I used the Reverse() method directly on my int array:
myIntArray.Reverse();
I notice that myIntArray[0] still comes out as 1.
What is the Reverse method actually doing here?
© Stack Overflow or respective owner